﻿using System;

namespace Microsoft.Xna.Framework.Graphics
{
    /// <summary>
    /// Contains presentation parameters.
    /// </summary>
    public class PresentationParameters
    {
        #region Constructors
        /// <summary>
        /// Initializes a new instance of this class.
        /// </summary>
        public PresentationParameters()
        {
			IsFullScreen = true;
        }
        #endregion Constructors

        #region Properties
		/// <summary>
		/// Gets or sets the format of the back buffer.
		/// </summary>
		public SurfaceFormat BackBufferFormat { get; set; }

		/// <summary>
		/// Gets or sets a value indicating the height of the new swap chain's back buffer.
		/// </summary>
		public int BackBufferHeight { get; set; }

		/// <summary>
		/// Gets or sets a value indicating the width of the new swap chain's back buffer.
		/// </summary>
		public int BackBufferWidth { get; set; }

		/// <summary>
		/// Gets the size of this resource.
		/// </summary>
		public Rectangle Bounds
		{
			get { return new Rectangle(0, 0, this.BackBufferWidth, this.BackBufferHeight); }
		}

		/// <summary>
		/// Gets or sets the depth stencil data format.
		/// </summary>
		public DepthFormat DepthStencilFormat { get; set; }

		/// <summary>
		/// Gets or sets the handle to the device window.
		/// </summary>
		public IntPtr DeviceWindowHandle { get; set; }

		/// <summary>
		/// Gets or sets the orientation of the display. The default value is <see cref="F:DisplayOrientation.Default"/>, which means orientation is determined automatically from your BackBufferWidth and BackBufferHeight.
		/// </summary>
		public DisplayOrientation DisplayOrientation { get; set; }

		/// <summary>
		/// Gets or sets a value indicating whether the application is in full screen mode.
		/// </summary>
		public bool IsFullScreen { get; set; }

		/// <summary>
		/// Gets or sets a value indicating the number of sample locations during multisampling.
		/// </summary>
		public int MultiSampleCount { get; set; }

		/// <summary>
		/// Gets or sets the maximum rate at which the swap chain's back buffers can be presented to the front buffer.
		/// </summary>
		public PresentInterval PresentationInterval { get; set; }

		/// <summary>
		/// Gets or sets render target usage flags.
		/// </summary>
		public RenderTargetUsage RenderTargetUsage { get; set; }
        #endregion

        #region Methods
        /// <summary>
        /// Creates a copy of this PresentationParameters object.
        /// </summary>
        public PresentationParameters Clone()
        {
            PresentationParameters clone = new PresentationParameters();
			clone.BackBufferFormat = this.BackBufferFormat;
			clone.BackBufferHeight = this.BackBufferHeight;
			clone.BackBufferWidth = this.BackBufferWidth;
			clone.DepthStencilFormat = this.DepthStencilFormat;
			clone.DeviceWindowHandle = this.DeviceWindowHandle;
			clone.DisplayOrientation = this.DisplayOrientation;
			clone.IsFullScreen = this.IsFullScreen;
			clone.MultiSampleCount = this.MultiSampleCount;
			clone.PresentationInterval = this.PresentationInterval;
			clone.RenderTargetUsage = this.RenderTargetUsage;
            return clone;
        }
        #endregion
    }
}
